package com.example.teesystem.entityDto;

import com.example.teesystem.common.utils.TimeUtil;
import com.example.teesystem.entity.ExamPaper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.Map;
import java.util.TreeMap;

/**
 * @author : NieYaShi
 * @version : v1.0
 * @createTime : 2022/4/15 16:12
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ExamPaperSimpleMessage {
    private Integer id;

    private String name;

    private String startTime = "";

    private String endTime = "";

    private Map<String, List<ExaminationIssueList>> listMap = new TreeMap<>();

    public ExamPaperSimpleMessage(ExamPaper examPaper){
        BeanUtils.copyProperties(examPaper, this);
        if (examPaper.getStartTime() != null) {
            this.startTime = TimeUtil.dateTimeToString(examPaper.getStartTime());
        }
        if (examPaper.getEndTime() != null) {
            this.endTime = TimeUtil.dateTimeToString(examPaper.getEndTime());
        }
    }
}
